import os

def remove_H(file_name):
    with open(f'/home/zhangqiang/userdata/wangzeyuan/Dynamic/Dynamic.Generation/data/proteingym_preprocess/{file_name}.pdb', 'r') as f_in:
        with open(f'/home/zhangqiang/userdata/wangzeyuan/Dynamic/Dynamic.Generation/data/proteingym/{file_name}.pdb', 'w') as f_out:
            for line in f_in:
                if line.strip().endswith('H'):
                    continue
                f_out.write(line)

if __name__ == '__main__':
    for root, dirs, files in os.walk('/home/zhangqiang/userdata/wangzeyuan/Dynamic/Dynamic.Generation/data/proteingym_preprocess'):
        for file in files:
            if file.endswith('.pdb'):
                remove_H(file[:-4])